//
//  BaseTableViewController.swift
//  SinaWeibo
//
//  Created by rk on 15/10/6.
//  Copyright © 2015年 kyy. All rights reserved.
//

import UIKit

//2.让代理遵守协议
class BaseTableViewController: UITableViewController,VisitorLoginViewDelegate{
    
    var visitorLoginView:VisitorLoginView?
    
    override func loadView() {
        
        visitorLoginView = NSBundle.mainBundle().loadNibNamed("VisitorLoginView", owner: nil, options: nil).last as? VisitorLoginView
        //设置代理
        visitorLoginView?.visitorViewDelegate = self
        
        view = visitorLoginView
        
        //添加导航栏的barButtonItem
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorWillRegister")
        
        self.navigationItem.rightBarButtonItem =
            UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorWillLogin")
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    
    //3.实现代理协议方法
    func visitorWillRegister() {
        print("代理协议方法---注册")
    }
    
    func visitorWillLogin() {
        print("代理协议方法---登录")
        
    }

  
}
